package cn.tedu.api;

import java.util.Arrays;
import java.util.Locale;

/**
 * @author: Dsi
 * @date: 2021/11/12 15:06
 * @description:该类用于测试String类的常用方法
 */
public class TestString2 {

    public static void main(String[] args) {
        String a1="abc";//常量池
        char[] a2={'a','b','c'};
        char[] a3=new char[]{'a','b','c'};
        String s=new String(a2);
        int a=1;

        System.out.println(a1.hashCode());//常量池
        System.out.println(s.hashCode());//常量池
        System.out.println(a2.hashCode());//在栈中

        System.out.println(a1);//字符串内容
        System.out.println(a2);
        System.out.println(a3);

        char[] c={'a','b','c'};
        String s1=new String(c);
        System.out.println(s1.length());
        System.out.println(s1.toUpperCase());
        System.out.println(s1.toLowerCase());
        System.out.println(s1.startsWith("a"));
        System.out.println(s1.endsWith("d"));

        System.out.println(s1.charAt(1));
        String s2="asdf";
        System.out.println(s2.indexOf("a"));
        System.out.println(Arrays.toString(s2.split("s")));


    }

}
